﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using DG.Tweening;
using System;

namespace YoUI.Core.UIAnima
{
    /// <summary>
    /// 图片组件颜色渐变
    /// </summary>
    [RequireComponent(typeof(Image))]
    [AddComponentMenu("YoUI/Anima/DoTweenFade")]
    public class YoTweenFade : YoTweenBase
    {
        public Image image;
        // 透明度
        public float opacity = 1f;

        protected override void Awake()
        {
            base.Awake();
            image = transform.GetComponent<Image>();
        }

        public override Tweener Anima()
        {
            return image.DOFade(opacity, duration);
        }
    }
}
